define(["jquery", "easy-admin"], function ($, ea) {

    var init = {
        table_elem: '#currentTable',
        table_render_id: 'currentTableRenderId',
        index_url: 'integralGoods.goods/index',
        add_url: 'integralGoods.goods/add',
        edit_url: 'integralGoods.goods/edit',
        delete_url: 'integralGoods.goods/delete',
        export_url: 'integralGoods.goods/export',
        modify_url: 'integralGoods.goods/modify',
    };

    var Controller = {

        index: function () {
            ea.table.render({
                init: init,
                cols: [[
                    {type: 'checkbox'},
                    {field: 'id', title: 'id'},
                    {field: 'coupon_id', title: '优惠券id'},
                    {field: 'storeCoupon.title', title: '优惠券名称'},
                    {field: 'goods_id', title: '商品id'},
                    {field: 'mall.title', title: '商品名称'},
                    {field: 'credits_exchange', title: '多少积分兑换'},
                    {field: 'start_time', title: '开始时间'},
                    {field: 'end_time', title: '结束时间'},
                    {field: 'number', title: '库存数量'},
                    {field: 'create_time', title: 'create_time'},

                    {width: 250, title: '操作', templet: ea.table.tool},

                ]],
            });

            ea.listen();
        },
        add: function () {
            ea.listen();
        },
        edit: function () {
            ea.listen();
        },
    };
    return Controller;
});